from multiprocessing import shared_memory

a = shared_memory.ShareableList(['howdy',b'hello',123,-3.14,None,True],name="liuj-test-list")
for entry in a:
    print("type:",type(entry),entry)

# b = shared_memory.ShareableList(name="liuj-test-list")
b = shared_memory.ShareableList(name=a.shm.name)
# 修改共享内存
b[0] = "lilisi"
b[-1] = False
for entry in b:
    print("type:",type(entry),entry)

a.shm.close()
a.shm.unlink()
b.shm.close()

""" 
type: <class 'str'> howdy
type: <class 'bytes'> b'hello'
type: <class 'int'> 123
type: <class 'float'> -3.14
type: <class 'NoneType'> None
type: <class 'bool'> True


type: <class 'str'> lilisi
type: <class 'bytes'> b'hello'
type: <class 'int'> 123
type: <class 'float'> -3.14
type: <class 'NoneType'> None
type: <class 'bool'> False
"""